package com.xnchat.pro.mapper;

import com.xnchat.pro.dto.Nicktable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 小凝
 */
public interface NickTableRepository extends JpaRepository<Nicktable,Integer> {
    @Transactional
    @Modifying
    @Query(nativeQuery=true,value="INSERT INTO `nicktable`(tripcode,welcomeline) VALUE(?1,?2) ON DUPLICATE KEY UPDATE welcomeline=?2" )
    int insertOrUpdate(String tripcode,String value);

    List<Nicktable> findAllByTripcode(String code);

}
